home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -in_the_mag- / reader_requests / wild / support / wilf / modules / strings.c < prev    next >
C/C++ Source or Header  |  2000-02-23  |  1KB  |  83 lines

  1. #ifndef FALSE
  2. #define FALSE    0
  3. #endif
  4. #ifndef TRUE
  5. #define TRUE    1
  6. #endif
  7.  
  8. #include <exec/types.h>
  9.  
  10. ULONG ChkIn(char *a,char *in)
  11. {
  12.  while (in[0]!=0)
  13.   {
  14.    if (a[0]!=in[0]) return(FALSE);
  15.    a++;
  16.    in++;
  17.   }
  18.  return(TRUE);
  19. }
  20.  
  21. ULONG *NextWord(char *b)
  22. {
  23.  while (b[0]!=9 & b[0]!=32 & b[0]!=0 & b[0]!=10)
  24.   {
  25.    b++;
  26.   } 
  27.  while (b[0]==9 | b[0]==32)                // skip spaces after word!
  28.   {
  29.    b++;
  30.   }
  31.  return(b);
  32. }
  33.  
  34. ULONG CopyWord(char *fill,char *word)
  35. {
  36.  int n=NULL;
  37.  while (word[0]!=9 & word[0]!=32 & word[0]!=0 & word[0]!=10)
  38.   {
  39.    fill[0]=word[0];
  40.    fill++;
  41.    word++;
  42.    n++;
  43.   }
  44.  fill[0]=0L;
  45.  return(n);
  46. }
  47.  
  48. ULONG CopyStr(char *fill,char *from)
  49. {
  50.  int n=NULL;
  51.  while (from[0]!=0)
  52.   {
  53.    fill[0]=from[0];
  54.    fill++;
  55.    from++;
  56.    n++;
  57.   }
  58.  fill[0]=0L;
  59.  return(n);
  60. }
  61.  
  62. ULONG StrLen(char *str)
  63. {
  64.  int n=NULL;
  65.  while (str[0]!=0 & str[0]!=10)
  66.   {
  67.    str++;
  68.    n++;
  69.   }
  70.  return(n); 
  71. }
  72.  
  73. ULONG StrCmp(char *a,char *b)
  74. {
  75.  while (a[0]!=0 & b[0]!=0 & a[0]!=10 & b[0]!=10)
  76.   {
  77.    if (a[0]!=b[0])
  78.     {return(FALSE);}
  79.    a++;
  80.    b++;
  81.   }
  82.  return(TRUE);
  83. }